From 7fa5e3ae97bec0ea6e454b648d12b92797178799 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Tue, 11 May 2010 12:37:26 +0100 Subject: [PATCH] xl: use help table to describe command help information This patch generate a help table to describe command help information. Signed-off-by: Wei Yongjun Signed-off-by: Keir Fraser Acked-by: Stefano Stabellini --- tools/libxl/xl_cmdimpl.c | 122 +++---------------------- tools/libxl/xl_cmdtable.c | 184 ++++++++++++++++++++++++++++++++------ tools/libxl/xl_cmdtable.h | 2 + 3 files changed, 173 insertions(+), 135 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index f9e2cd647a..f1e03913fa 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -1170,114 +1170,20 @@ void help(char *command) for (i = 0; i < cmdtable_len; i++) printf(" %-20s%s\n", cmd_table[i].cmd_name, cmd_table[i].cmd_desc); - } else if(!strcmp(command, "create")) { - printf("Usage: xl create [options] [vars]\n\n"); - printf("Create a domain based on .\n\n"); - printf("Options:\n\n"); - printf("-h Print this help.\n"); - printf("-p Leave the domain paused after it is created.\n"); - printf("-c Connect to the console after the domain is created.\n"); - printf("-d Enable debug messages.\n"); - printf("-e Do not wait in the background for the death of the domain.\n"); - } else if(!strcmp(command, "list")) { - printf("Usage: xl list [-v] [Domain]\n\n"); - printf("List information about all/some domains.\n\n"); - } else if(!strcmp(command, "pci-attach")) { - printf("Usage: xl pci-attach [Virtual Slot]\n\n"); - printf("Insert a new pass-through pci device.\n\n"); - } else if(!strcmp(command, "pci-detach")) { - printf("Usage: xl pci-detach \n\n"); - printf("Remove a domain's pass-through pci device.\n\n"); - } else if(!strcmp(command, "pci-list")) { - printf("Usage: xl pci-list \n\n"); - printf("List pass-through pci devices for a domain.\n\n"); - } else if(!strcmp(command, "pause")) { - printf("Usage: xl pause \n\n"); - printf("Pause execution of a domain.\n\n"); - } else if(!strcmp(command, "unpause")) { - printf("Usage: xl unpause \n\n"); - printf("Unpause a paused domain.\n\n"); - } else if(!strcmp(command, "save")) { - printf("Usage: xl save [options] []\n\n"); - printf("Save a domain state to restore later.\n\n"); - printf("Options:\n\n"); - printf("-h Print this help.\n"); - printf("-c Leave domain running after creating the snapshot.\n"); - } else if(!strcmp(command, "restore")) { - printf("Usage: xl restore [options] [] \n\n"); - printf("Restore a domain from a saved state.\n\n"); - printf("Options:\n\n"); - printf("-h Print this help.\n"); - printf("-p Do not unpause domain after restoring it.\n"); - printf("-e Do not wait in the background for the death of the domain.\n"); - printf("-d Enable debug messages.\n"); - } else if(!strcmp(command, "migrate")) { - printf("Usage: xl migrate [options] \n\n"); - printf("Save a domain state to restore later.\n\n"); - printf("Options:\n\n"); - printf("-h Print this help.\n"); - printf("-C Send instead of config file from creation.\n"); - printf("-s Use instead of ssh. String will be passed to sh. If empty, run instead of ssh xl migrate-receive [-d -e]\n"); - printf("-e Do not wait in the background (on ) for the death of the domain.\n"); - } else if(!strcmp(command, "migrate-receive")) { - printf("Usage: xl migrate-receive - for internal use only"); - } else if(!strcmp(command, "restore")) { - printf("Usage: xl restore [options] [] \n\n"); - printf("Restore a domain from a saved state.\n\n"); - printf("Options:\n\n"); - printf("-h Print this help.\n"); - printf("-O Old (configless) xl save format.\n"); - printf("-p Do not unpause domain after restoring it.\n"); - printf("-e Do not wait in the background for the death of the domain.\n"); - } else if(!strcmp(command, "destroy")) { - printf("Usage: xl destroy \n\n"); - printf("Terminate a domain immediately.\n\n"); - } else if (!strcmp(command, "console")) { - printf("Usage: xl console \n\n"); - printf("Attach to domain's console.\n\n"); - } else if (!strcmp(command, "cd-insert")) { - printf("Usage: xl cd-insert \n\n"); - printf("Insert a cdrom into a guest's cd drive.\n\n"); - } else if (!strcmp(command, "cd-eject")) { - printf("Usage: xl cd-eject \n\n"); - printf("Eject a cdrom from a guest's cd drive.\n\n"); - } else if (!strcmp(command, "mem-set")) { - printf("Usage: xl mem-set \n\n"); - printf("Set the current memory usage for a domain.\n\n"); - } else if (!strcmp(command, "button-press")) { - printf("Usage: xl button-press